<template>
  <div class="userLayout">
    <div class="login_panel">
      <el-row>
        <el-col :xs="0">
          <img
            class="login_panel_left_img"
            src="@/assets/images/login_left.svg"
          />
        </el-col>
      </el-row>
      <el-row>
        <el-col :xs="24" :sm="24">
          <div class="selectUserRole">
            <h1
              style="margin-bottom: 40px; font-size: 25px; margin-left: -15px"
            >
              请选择你要注册的角色
            </h1>
            <el-select v-model="userRole.role" placeholder="请选择要注册的角色">
              <el-option label="求职者" :value="1"></el-option>
              <el-option label="hr" :value="2"></el-option>
            </el-select>
          </div>
        </el-col>
        <el-button
          @click="gotoRegister"
          style="margin-top: 20px; width: 200px"
          type="primary"
          plain
        >
          前往注册
        </el-button>
      </el-row>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  name: 'Login',
}
</script>

<script setup lang="ts">
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
const userRole = reactive({
  role: 1,
})

const router = useRouter()

const gotoRegister = () => {
  if (userRole.role === 1) {
    console.log(userRole.role, '求职者')
    // 跳转路由
    router.push('/register/jobSeeker')
  } else {
    console.log(userRole.role, 'hr')
    router.push('/register/hr')
  }
}
</script>

<style lang="scss" scoped>
.userLayout {
  background-image: url('@/assets/images/login_background.jpg');
  background-size: cover;
  width: 100vw;
  height: 100vh;
  position: relative;

  .login_panel {
    position: absolute;
    top: 3vh;
    left: 2vw;
    width: 96vw;
    height: 94vh;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-evenly;

    .login_panel_left_img {
      width: 100%;
      height: 100%;
    }

    .login_panel_form {
      width: 500px;
      background-color: #fff;
      padding: 40px 40px 40px 40px;
      border-radius: 10px;
      box-shadow: 2px 3px 7px rgba(0, 0, 0, 0.2);
      z-index: 100;

      .login_panel_form_title {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 30px 0;

        .login_panel_form_title_logo {
          width: 90px;
          height: 72px;
        }

        .login_panel_form_title_p {
          font-size: 40px;
          padding-left: 20px;
        }
      }
    }
  }
}

//小屏幕不显示右侧，将登录框居中
@media (max-width: 750px) {
  .login_panel_right {
    display: none;
  }

  .login_panel {
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
  }

  .login_panel_form {
    width: 100%;
  }
}
/*
    powerBy : bypanghu@163.com
  */
</style>
